import Login from "./views/login.js";
import Reg from "./views/reg.js";
import Info from "./views/info.js";
import AddMovie from "./views/moive/addMovie.js";
import MovieImg from "./views/moive/movieImg.js";
import MovieList from "./views/moive/movieList.js";
import UpdateMovie from "./views/moive/updateMovie.js";
import AddCinema from "./views/cinema/addCinema.js";
import CinemaList from "./views/cinema/cinemaList.js";
import UpdateCinema from "./views/cinema/updateCinema.js";
import AddTheater from "./views/movieTheater/addTheater.js";
import TheaterList from "./views/movieTheater/TheaterList.js";
import UpdateTheater from "./views/movieTheater/updateTheater.js";
import SeatList from "./views/seat/seatList.js";
import AddSchedules from "./views/schedules/addSchedules.js";
import SchedulesList from "./views/schedules/schedulesList.js";
import updataSchedule from "./views/schedules/updataSchedule.js";
import AddUser from "./views/user/addUser.js";
import userList from "./views/user/userlist.js";
import scheduleTheaterList from "./views/schedules/scheduleTheaterList.js";


var routes = {
    '/login': () => {
        new Login({
            el: "#content"
        })
    },
    '/loginWith/:adminname': (adminname) => {
        new Login({
            el: "#content",
            adminname
        })
    },
    '/reg': () => {
        new Reg({
            el: "#content"
        })
    },
    '/info': {
        on: () => {
            if ($(".info-content").length) return;
            new Info({
                el: "#content"
            })
        },
        "/addMovie": () => {
            new AddMovie({
                el: ".info-content"
            })
        },
        "/movieImg": () => {
            new MovieImg({
                el: ".info-content"
            })
        },
        "/movieList":()=>{
            new MovieList({
                el: ".info-content"
            })
        },
        "/updateMovie":()=>{
            new UpdateMovie({
                el: ".info-content"
            })
        },
        "/addCinema": () => {
            new AddCinema({
                el: ".info-content"
            })
        },
        "/cinemaList":()=>{
            new CinemaList({
                el: ".info-content"
            })
        },
        "/updateCinema":()=>{
            new UpdateCinema({
                el: ".info-content"
            })
        },
        "/addTheater": () => {
            new AddTheater({
                el: ".info-content"
            })
        },
        "/theaterList":()=>{
            new TheaterList({
                el: ".info-content"
            })
        },
        "/updateTheater":()=>{
            new UpdateTheater({
                el: ".info-content"
            })
        },
        "/seatList":()=>{
            new SeatList({
                el: ".info-content"
            })
        },
        "/addSchedules": () => {
            new AddSchedules({
                el: ".info-content"
            })
        },
        "/schedulesList":()=>{
            new SchedulesList({
                el: ".info-content"
            })
        },
        "/moveTheaterList":()=>{
            new scheduleTheaterList({
                el: ".info-content"
            })
        },
        "/updataSchedule":()=>{
            new updataSchedule({
                el: ".info-content"
            })
        },
        "/addUser": () => {
            new AddUser({
                el: ".info-content"
            })
        },
        "/userList":()=>{
            new userList({
                el: ".info-content"
            })
        },
    },
};

var router = Router(routes).configure({
    recurse: 'forward'
});

export default {
    init() {
        router.init();
        location.hash = location.hash || "#/login";
    }
}